home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume27 / hp2pbm / patch01 next >
Encoding:
Text File  |  1992-01-05  |  27.3 KB  |  1,110 lines

  1. Newsgroups: comp.sources.misc
  2. From: clewis@ferret.ocunix.on.ca (Chris Lewis)
  3. Subject:  v27i071:  hp2pbm - HP PCL to Portable Bit Map converter, Patch01
  4. Message-ID: <1992Jan6.163713.10954@sparky.imd.sterling.com>
  5. X-Md4-Signature: 21a158e21441aa5f39676a9e9fddde3d
  6. Date: Mon, 6 Jan 1992 16:37:13 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: clewis@ferret.ocunix.on.ca (Chris Lewis)
  10. Posting-number: Volume 27, Issue 71
  11. Archive-name: hp2pbm/patch01
  12. Environment: UNIX
  13. Patch-To: hp2pbm: Volume 26, Issue 102-104
  14.  
  15. This is the official patch 01 for Hp2pbm.  Please apply it by:
  16.  
  17.     cd <hp2pbm source directory>
  18.     patch -N -p < <this file>
  19.  
  20. Michael Haws, uunet!yonder!michael, did a fair amount of work
  21. on hp2pbm, and they comprise most of the changes in this patch.
  22. I include his description here:
  23.  
  24. | Items that still require some work include:  All measurements should
  25. | be kept in units of 1/3600 inches as opposed to dots (1/300).  The HPLJII uses
  26. | 1/3600 inches as it's unit of measure.  The HPLJII then converts this unit
  27. | to dots (1/300) just prior to printing (see HP Technical Reference Manual).  
  28. | Fixed underlining is now supported correctly, floating underlining is yet
  29. | to be added.
  30. | All in all I am very pleased with hp2pbm and want to thank all involved
  31. | for their efforts.
  32. | My changes to hp2pbm include:
  33. |     1. Left and right margins are now stored in units of dots and
  34. |        not columns.  Column positions are affected by changes in
  35. |        HMI, while left and right margins need to be fixed positions.
  36. |     2. Type of clen variable was changed from short to double so 
  37. |        that it could handle fractional lengths.
  38. |     3. Left edge of the logical page is defined to be 50 dots and
  39. |        is stored in LEFT_LOGICAL.  Right edge of logical page is
  40. |        stored in RITE_LOGICAL.  BMX must never be less than
  41. |        LEFT_LOGICAL nor greater than RITE_LOGICAL.
  42. |     4. getcfn() now makes certain that the current font meets the 
  43. |        latest font selection criteria.
  44. |     5. Resetting text length now works correctly.
  45. |     6. Resetting column now works correctly.
  46. |     7. Improved method for underlining.  Still needs work.
  47. |     
  48. |     8. Added code to handle the tab character.
  49. |     9. Carriage return now works properly.
  50. |     10. Formfeeds now work properly.
  51.  
  52. Thank you Michael!
  53.  
  54. Further, I modified the "-r" option to permit the specification of
  55. a pipeline.  So, for example, you can use this with psroff driving
  56. an Epson 24 pin printer thusly:
  57.  
  58.     psroff -Tlj -t ... | hp2e24 '-r|pbm2e24' | <your spooler>
  59.  
  60.  
  61. ./hp2pbm.S        -r documentation, general fixups
  62. ./Makefile        added a regression test
  63. ./hpfntwrite.c        Michael's changes plus -r
  64. ./hpp.c            -r
  65. ./hptopbm.h        Version now is V1.01
  66.  
  67. Patchwrapped: 920105232033
  68.  
  69. Index: ./hp2pbm.S
  70. *** /tmp/PATCHold/./hp2pbm.S    Sun Jan  5 23:18:30 1992
  71. --- ./hp2pbm.S    Sun Jan  5 23:18:31 1992
  72. ***************
  73. *** 1,4 ****
  74. ! .\"Copyright 1989, 1990, 1991 by Chris Lewis 1.1 91/12/03
  75.   .TH HP2PBM %%MANEXT%% "standalone"
  76.   .SH NAME
  77.   hp2pbm,hp2hifax,hp2lofax,hp2sun,hp2e24 \- Translate HPLJ codes to to Postscript or PBM
  78. --- 1,4 ----
  79. ! .\"Copyright 1989, 1990, 1991 by Chris Lewis 1.2 92/01/05
  80.   .TH HP2PBM %%MANEXT%% "standalone"
  81.   .SH NAME
  82.   hp2pbm,hp2hifax,hp2lofax,hp2sun,hp2e24 \- Translate HPLJ codes to to Postscript or PBM
  83. ***************
  84. *** 14,21 ****
  85.   .SH DESCRIPTION
  86.   The
  87.   .B hp2pbm
  88. ! program (linked to any of its aliases) is a program that interprets HP PCL (Hewlett Packard Printer Control
  89. ! Language - the language of HP Laserjets)
  90.   escape code sequences.
  91.   .B Hp2pbm
  92.   can then generate an english description of the codes, translate the input
  93. --- 14,21 ----
  94.   .SH DESCRIPTION
  95.   The
  96.   .B hp2pbm
  97. ! program (linked to any of its aliases) is a program that interprets HP PCL
  98. ! (Hewlett Packard Printer Control Language - the language of HP Laserjets)
  99.   escape code sequences.
  100.   .B Hp2pbm
  101.   can then generate an english description of the codes, translate the input
  102. ***************
  103. *** 31,37 ****
  104.   that has been extended to optionally emit PBM.
  105.   .B Hpinterp
  106.   is a part of
  107. ! .BR psroff 
  108.   This can be considered to be an ``after market'' optional upgrade
  109.   to
  110.   .BR psroff .
  111. --- 31,37 ----
  112.   that has been extended to optionally emit PBM.
  113.   .B Hpinterp
  114.   is a part of
  115. ! .BR psroff .
  116.   This can be considered to be an ``after market'' optional upgrade
  117.   to
  118.   .BR psroff .
  119. ***************
  120. *** 48,56 ****
  121.   .BR CorelDraw ,
  122.   including (some) built in and all downloaded fonts (except
  123.   compressed ones) and including built in and downloaded graphics and rasters.
  124. ! hp2pbm can be used to drive a number of different configurations, such as
  125.   Postscript printers, Klaus Schallhorn's
  126. ! .B faxpak 
  127.   (to transmit faxes using a fax modem),
  128.   or other devices using PBM converters, such as Epson 24 pin printers,
  129.   Sun displays, 3b1 consoles etc.
  130. --- 48,57 ----
  131.   .BR CorelDraw ,
  132.   including (some) built in and all downloaded fonts (except
  133.   compressed ones) and including built in and downloaded graphics and rasters.
  134. ! .B Hp2pbm
  135. ! can be used to drive a number of different configurations, such as
  136.   Postscript printers, Klaus Schallhorn's
  137. ! .B faxpak
  138.   (to transmit faxes using a fax modem),
  139.   or other devices using PBM converters, such as Epson 24 pin printers,
  140.   Sun displays, 3b1 consoles etc.
  141. ***************
  142. *** 68,74 ****
  143.   option tells
  144.   .B hp2pbm
  145.   to emit Postscript to standard output.
  146. ! (Specifying both \-v and \-p at the same time is rather confusing)
  147.   Note: unless
  148.   .B hp2pbm
  149.   is used with the rest of the
  150. --- 69,75 ----
  151.   option tells
  152.   .B hp2pbm
  153.   to emit Postscript to standard output.
  154. ! Specifying both \-v and \-p at the same time is rather confusing.
  155.   Note: unless
  156.   .B hp2pbm
  157.   is used with the rest of the
  158. ***************
  159. *** 90,102 ****
  160.   .BI f n
  161.   where \f2n\fP is the HP PCL font ID number.
  162.   The ``FONTS'' directory should be created manually before running
  163. ! .B hp2pbm.
  164.   A file called
  165.   .BI f n .desc
  166.   is also created in the ``FONTS'' directory, which contains a description of
  167.   each character.
  168.   If the \-c option is specified, an ASCII drawing will be made
  169. ! of each glyph in the font in the 
  170.   .B .desc
  171.   file.
  172.   This is very useful for examining HP PCL fonts, whether they are
  173. --- 91,103 ----
  174.   .BI f n
  175.   where \f2n\fP is the HP PCL font ID number.
  176.   The ``FONTS'' directory should be created manually before running
  177. ! .B hp2pbm .
  178.   A file called
  179.   .BI f n .desc
  180.   is also created in the ``FONTS'' directory, which contains a description of
  181.   each character.
  182.   If the \-c option is specified, an ASCII drawing will be made
  183. ! of each glyph in the font in the
  184.   .B .desc
  185.   file.
  186.   This is very useful for examining HP PCL fonts, whether they are
  187. ***************
  188. *** 106,115 ****
  189.   .BI \-r value
  190.   option is specified,
  191.   .B hp2pbm
  192. ! (hp2??fax and hp2e24) 
  193. ! creates PBM files. The associated argument is
  194. ! the basename for the generated files.
  195.   The first page is named ``value.0'', second ``value.1'' etc.
  196.   The \-d option specifies a resolution not automatically assumed
  197.   from argv[0].
  198.   It is specified as
  199. --- 107,130 ----
  200.   .BI \-r value
  201.   option is specified,
  202.   .B hp2pbm
  203. ! (hp2??fax and hp2e24) creates PBM files.
  204. ! The associated argument is the basename for the generated files.
  205.   The first page is named ``value.0'', second ``value.1'' etc.
  206. + If
  207. + .I value
  208. + has a pipe symbol (``|'') as the first character, the rest
  209. + .I value
  210. + is used as a pipeline to send each page.
  211. + Hence, for example, you can use
  212. + .B hp2pbm
  213. + with psroff like so:
  214. + .sp
  215. + .nf
  216. + .in +1i
  217. + psroff -Tlj -t file | hp2e24 '-r|pbm2e24' | lp
  218. + .in -1i
  219. + .fi
  220. + .P
  221.   The \-d option specifies a resolution not automatically assumed
  222.   from argv[0].
  223.   It is specified as
  224. ***************
  225. *** 145,160 ****
  226.   Hewlett Packard Laserjet documentation.
  227.   Adobe Systems Postscript documentation.
  228.   .SH WARNINGS
  229. - .B Hp2pbm's 
  230. - handling of downloaded macros is not fully tested. 
  231. - Compressed fonts (Laserjet II) and scalable built in fonts (Laserjet 
  232. - III) are not supported. Except for these limitations
  233. - .B Hp2pbm
  234. - should be fully compatible with Laserjet II printers. 
  235.   .P
  236. ! PBM file sizes are resolution dependent (legal size or A4 paper 
  237. ! at 300DPI: as much as 1.2Mb for each page).
  238.   .P
  239.   The
  240.   .B \-p
  241.   option was implemented soley as a test jig for the HP PCL output
  242. --- 160,179 ----
  243.   Hewlett Packard Laserjet documentation.
  244.   Adobe Systems Postscript documentation.
  245.   .SH WARNINGS
  246.   .P
  247. ! .B "Hp2pbm output can be huge!"
  248. ! PBM file sizes are resolution dependent.
  249. ! At 300DPI a legal size sheet is 1.2 megabytes
  250. ! .B "PER PAGE" !
  251.   .P
  252. + .B "Hp2pbm's"
  253. + handling of downloaded macros is not fully tested.
  254. + Compressed fonts (Laserjet II) and scalable built in fonts (Laserjet
  255. + III) are not supported.
  256. + Except for these limitations
  257. + .B Hp2pbm
  258. + should be fully compatible with Laserjet II printers.
  259. + .P
  260.   The
  261.   .B \-p
  262.   option was implemented soley as a test jig for the HP PCL output
  263. ***************
  264. *** 164,174 ****
  265.   The Postscript generating code isn't complete, but this will
  266.   probably be rectified in future.
  267.   .P
  268. ! .B Hp2ps
  269.   will not create a FONTS directory if one doesn't exist, and will die if
  270.   there isn't one.
  271. ! .PP
  272. ! .B "Hp2ps \-p"
  273.   will attempt to do something sane with selecting a font by characteristic,
  274.   but be warned, these use the printer's built-in fonts (which are likely
  275.   to be radically different from a LJ's), so the widths may be different and
  276. --- 183,193 ----
  277.   The Postscript generating code isn't complete, but this will
  278.   probably be rectified in future.
  279.   .P
  280. ! .B Hp2pbm
  281.   will not create a FONTS directory if one doesn't exist, and will die if
  282.   there isn't one.
  283. ! .P
  284. ! .B "Hp2pbm \-p"
  285.   will attempt to do something sane with selecting a font by characteristic,
  286.   but be warned, these use the printer's built-in fonts (which are likely
  287.   to be radically different from a LJ's), so the widths may be different and
  288. Index: ./Makefile
  289. *** /tmp/PATCHold/./Makefile    Sun Jan  5 23:18:40 1992
  290. --- ./Makefile    Sun Jan  5 23:18:41 1992
  291. ***************
  292. *** 1,4 ****
  293. ! # Makefile for hptopbm standalone release 1.2 91/12/03
  294.   
  295.   #    Configuration:
  296.   
  297. --- 1,4 ----
  298. ! # Makefile for hptopbm standalone release 1.3 92/01/05
  299.   
  300.   #    Configuration:
  301.   
  302. ***************
  303. *** 61,74 ****
  304.           @chmod 444 $@
  305.   
  306.   # components
  307. ! mem.o:        mem.c
  308. !         $(CC) -c $(CFLAGS) mem.c
  309.   
  310. ! hpp.o:        hptopbm.h hpp.c
  311. !         $(CC) -c $(CFLAGS) hpp.c
  312.   
  313.   hpfntwrite.o:    hptopbm.h hpfntwrite.c
  314. !         $(CC) -c $(CFLAGS) hpfntwrite.c
  315.   
  316.   pbm2e24:    pbm2e24.o mem.o
  317.           $(CC) $(CFLAGS) -o pbm2e24 pbm2e24.o mem.o $(LIBFLAGS)
  318. --- 61,74 ----
  319.           @chmod 444 $@
  320.   
  321.   # components
  322. ! #mem.o:        mem.c
  323. ! #        $(CC) -c $(CFLAGS) mem.c
  324.   
  325. ! hpp.o:        hptopbm.h # hpp.c
  326. ! #        $(CC) -c $(CFLAGS) hpp.c
  327.   
  328.   hpfntwrite.o:    hptopbm.h hpfntwrite.c
  329. ! #        $(CC) -c $(CFLAGS) hpfntwrite.c
  330.   
  331.   pbm2e24:    pbm2e24.o mem.o
  332.           $(CC) $(CFLAGS) -o pbm2e24 pbm2e24.o mem.o $(LIBFLAGS)
  333. ***************
  334. *** 78,88 ****
  335. --- 78,95 ----
  336.   
  337.   $(LIBFILES):
  338.           uudecode < $@.UU
  339. +         chmod 444 $@
  340.   
  341.   myuid:
  342.           echo 'main() { printf("%d%c", getuid(), 10); exit(0); }' > myuid.c
  343.           $(CC) -o myuid myuid.c
  344.           rm -f myuid.c
  345. + regression:    hp2pbm
  346. +         psroff -t -Tlj testdoc > /tmp/testdoc.lj
  347. +         ./hp2pbm -r/tmp/new -d80,80 < /tmp/testdoc.lj
  348. +         $(BINDIR)/hp2pbm -r/tmp/old -d80,80 < /tmp/testdoc.lj
  349. +         ./hp2pbm '-r|pbm2e24' -d80,80 > /tmp/pipe < /tmp/testdoc.lj
  350.   
  351.   install:    hp2pbm myuid
  352.           test "`./myuid`" = 0 || \
  353. Index: ./hpfntwrite.c
  354. *** /tmp/PATCHold/./hpfntwrite.c    Sun Jan  5 23:18:51 1992
  355. --- ./hpfntwrite.c    Sun Jan  5 23:18:55 1992
  356. ***************
  357. *** 18,24 ****
  358.   #include "hptopbm.h"
  359.   
  360.   #ifndef    lint
  361. ! char SCCSid[] = "@(#)hpfntwrite.c: 1.1 91/12/03 00:34:42";
  362.   #endif
  363.   
  364.   #ifdef    FAXPAK
  365. --- 18,24 ----
  366.   #include "hptopbm.h"
  367.   
  368.   #ifndef    lint
  369. ! char SCCSid[] = "@(#)hpfntwrite.c: 1.3 92/01/05 23:16:27";
  370.   #endif
  371.   
  372.   #ifdef    FAXPAK
  373. ***************
  374. *** 66,72 ****
  375.           dpi,
  376.           pID,
  377.           top_dots,
  378. -         left_dots,
  379.           text_len;
  380.       double    hmi,
  381.           lhite,
  382. --- 66,71 ----
  383. ***************
  384. *** 118,124 ****
  385.   
  386.   struct    CHAR_BITMAP
  387.   {
  388. !     short len, hite, clen, toffs, loffs;
  389.       uchar **CH;
  390.   };
  391.   
  392. --- 117,124 ----
  393.   
  394.   struct    CHAR_BITMAP
  395.   {
  396. !     short len, hite, toffs, loffs;
  397. !     double clen;
  398.       uchar **CH;
  399.   };
  400.   
  401. ***************
  402. *** 214,226 ****
  403.       lpi = 6.0;
  404.       orgenv.page_len = PAGE_LEN;
  405.       orgenv.top_margin = new_topmargin = TOP_MARGIN;
  406. !     orgenv.left_margin = LEFT_MARGIN;
  407. !     orgenv.rite_margin = RITE_MARGIN;
  408.       orgenv.text_len = PAGE_LEN - TOP_MARGIN;
  409.       orgenv.text_len -= 3;
  410.       orgenv.lhite = 50;
  411.       orgenv.top_dots = fax_head_size + orgenv.top_margin*orgenv.lhite;
  412. -     orgenv.left_dots = 47;    /* dots = .157 in */
  413.       orgenv.dpi = 75;    /* hp 2686a */
  414.       stackpos = 0;
  415.       try_select = 0;
  416. --- 214,225 ----
  417.       lpi = 6.0;
  418.       orgenv.page_len = PAGE_LEN;
  419.       orgenv.top_margin = new_topmargin = TOP_MARGIN;
  420. !     orgenv.left_margin = LEFT_LOGICAL;
  421. !     orgenv.rite_margin = RITE_LOGICAL;
  422.       orgenv.text_len = PAGE_LEN - TOP_MARGIN;
  423.       orgenv.text_len -= 3;
  424.       orgenv.lhite = 50;
  425.       orgenv.top_dots = fax_head_size + orgenv.top_margin*orgenv.lhite;
  426.       orgenv.dpi = 75;    /* hp 2686a */
  427.       stackpos = 0;
  428.       try_select = 0;
  429. ***************
  430. *** 257,263 ****
  431.           {
  432.               cf = &hf->chars[i];
  433.               cf->CH = (uchar **)NULL;
  434. !             cf->len = cf->hite = cf->clen = cf->toffs = cf->loffs = 0;
  435.           }
  436.       }
  437.       hf = &hpfonts[LINEPRINTER];
  438. --- 256,263 ----
  439.           {
  440.               cf = &hf->chars[i];
  441.               cf->CH = (uchar **)NULL;
  442. !             cf->len = cf->hite = cf->toffs = cf->loffs = 0;
  443. !             cf->clen = 0;
  444.           }
  445.       }
  446.       hf = &hpfonts[LINEPRINTER];
  447. ***************
  448. *** 302,308 ****
  449.   xyinit()
  450.   {
  451.       BMY = orgenv.top_dots;
  452. !     BMX = 0.0;
  453.       GRAPHX = 0.0;
  454.   }
  455.   ovlyinit()
  456. --- 302,308 ----
  457.   xyinit()
  458.   {
  459.       BMY = orgenv.top_dots;
  460. !     BMX = LEFT_LOGICAL;
  461.       GRAPHX = 0.0;
  462.   }
  463.   ovlyinit()
  464. ***************
  465. *** 420,430 ****
  466.   end_bitmap(tname)
  467.   char *tname;
  468.   {
  469. !     int i, j, xmax;
  470.       FILE *fp;
  471.   
  472. !     if ((fp = fopen(tname, "w")) == NULL)
  473. !         die("cannot create pbm file %s\n",tname);
  474.   
  475.       ymax_used = yscale[max_ln-1];
  476.   #ifdef    FAXPAK
  477. --- 420,438 ----
  478.   end_bitmap(tname)
  479.   char *tname;
  480.   {
  481. !     int i, j, xmax, pipe;
  482.       FILE *fp;
  483.   
  484. !     if (tname[0] == '|') {
  485. !         fp = popen(tname+1, "w");
  486. !         pipe = 1;
  487. !     } else {
  488. !         fp = fopen(tname, "w");
  489. !         pipe = 0;
  490. !     }
  491. !     if (fp == NULL)
  492. !         die("cannot create pbm file `%s'\n",tname);
  493.   
  494.       ymax_used = yscale[max_ln-1];
  495.   #ifdef    FAXPAK
  496. ***************
  497. *** 442,448 ****
  498.                   j,xmax,i,ymax_used);
  499.           (void)memset((char*)block[i], '\0', xmax);
  500.       }
  501. !     fclose(fp);
  502.   
  503.       ymax_used = xmax_used = 0;
  504.       orgenv.top_margin = new_topmargin;
  505. --- 450,460 ----
  506.                   j,xmax,i,ymax_used);
  507.           (void)memset((char*)block[i], '\0', xmax);
  508.       }
  509. !     if (pipe) {
  510. !         if (pclose(fp))
  511. !         die("Pipe failure in `%s'\n", tname);
  512. !     } else
  513. !         fclose(fp);
  514.   
  515.       ymax_used = xmax_used = 0;
  516.       orgenv.top_margin = new_topmargin;
  517. ***************
  518. *** 458,463 ****
  519. --- 470,477 ----
  520.   {
  521.       struct HPFONT *hpf;
  522.   
  523. +     if (try_select)
  524. +         best_match();
  525.       if (curenv->cur_fnt < 0 || curenv->cur_fnt >= MAX_FONT)
  526.           die("don't know font %d\n",curenv->cur_fnt);
  527.       hpf = &hpfonts[curenv->cur_fnt];
  528. ***************
  529. *** 492,500 ****
  530.   }
  531.   lr_default()
  532.   {
  533. !     curenv->left_margin = LEFT_MARGIN;
  534. !     curenv->left_dots = 47;
  535. !     curenv->rite_margin = RITE_MARGIN;
  536.   }
  537.   hmi_default()
  538.   {
  539. --- 506,513 ----
  540.   }
  541.   lr_default()
  542.   {
  543. !     curenv->left_margin = LEFT_LOGICAL;
  544. !     curenv->rite_margin = RITE_LOGICAL;
  545.   }
  546.   hmi_default()
  547.   {
  548. ***************
  549. *** 526,532 ****
  550.       if (cptr->CH)
  551.           free((char*)cptr->CH);
  552.       cptr->CH = (uchar **)NULL;
  553. !     cptr->len = cptr->hite = cptr->clen = cptr->toffs = cptr->loffs = 0;
  554.   }
  555.   clear1font(fptr)
  556.   struct HPFONT *fptr;
  557. --- 539,546 ----
  558.       if (cptr->CH)
  559.           free((char*)cptr->CH);
  560.       cptr->CH = (uchar **)NULL;
  561. !     cptr->len = cptr->hite = cptr->toffs = cptr->loffs = 0;
  562. !     cptr->clen = 0;
  563.   }
  564.   clear1font(fptr)
  565.   struct HPFONT *fptr;
  566. ***************
  567. *** 702,708 ****
  568.   rs_tlen(n)
  569.   double n;
  570.   {
  571. !     if (n && (n <= (curenv->page_len - curenv->top_margin)))
  572.           curenv->text_len = (int)n;
  573.       else if (!n)
  574.           tlen_default();
  575. --- 716,722 ----
  576.   rs_tlen(n)
  577.   double n;
  578.   {
  579. !     if (n && (n * curenv->lhite <= (PAGE_LEN*50) - curenv->top_dots - 150))
  580.           curenv->text_len = (int)n;
  581.       else if (!n)
  582.           tlen_default();
  583. ***************
  584. *** 711,720 ****
  585.   double n;
  586.   {
  587.       cfn = getcfn();
  588. !     if (n < curenv->rite_margin)
  589.       {
  590. !         curenv->left_margin = (int)n;
  591. !         curenv->left_dots = curenv->left_margin * cfn->space_len;
  592.       }
  593.   }
  594.   rs_mright(n)
  595. --- 725,735 ----
  596.   double n;
  597.   {
  598.       cfn = getcfn();
  599. !     if (LEFT_LOGICAL + (n * cfn->space_len) < curenv->rite_margin)
  600.       {
  601. !         curenv->left_margin = n * cfn->space_len + LEFT_LOGICAL;
  602. !         if (BMX < curenv->left_margin)
  603. !             BMX = curenv->left_margin;
  604.       }
  605.   }
  606.   rs_mright(n)
  607. ***************
  608. *** 728,739 ****
  609.   {
  610.       cfn = getcfn();
  611.       if (relative())
  612. !         BMX += n*cfn->space_len;
  613. !     else if (!(int)n)
  614. !         BMX = curenv->left_dots;
  615. !     else BMX = n*cfn->space_len;
  616. !     BMX = max(0.0, BMX);
  617. !     BMX = min(BMX, (double)((RITE_MARGIN-1)*30));    /* using 10cpi for max */
  618.   }
  619.   rs_row(n)
  620.   double n;
  621. --- 743,752 ----
  622.   {
  623.       cfn = getcfn();
  624.       if (relative())
  625. !         BMX = ((int)(BMX * 12) + (int)(n*cfn->space_len*12)) / 12.0;
  626. !     else BMX = LEFT_LOGICAL + n*cfn->space_len;
  627. !     BMX = max(LEFT_LOGICAL,BMX);
  628. !     BMX = min(BMX, RITE_LOGICAL);
  629.   }
  630.   rs_row(n)
  631.   double n;
  632. ***************
  633. *** 744,750 ****
  634.       {
  635.           curenv->top_margin = new_topmargin;
  636.           curenv->top_dots = fax_head_size + curenv->top_margin*curenv->lhite;
  637. !         BMY = (double)curenv->top_dots * curenv->lhite;
  638.           return;
  639.       }
  640.       if (relative())
  641. --- 757,763 ----
  642.       {
  643.           curenv->top_margin = new_topmargin;
  644.           curenv->top_dots = fax_head_size + curenv->top_margin*curenv->lhite;
  645. !         BMY = (double)curenv->top_dots;
  646.           return;
  647.       }
  648.       if (relative())
  649. ***************
  650. *** 757,763 ****
  651. --- 770,779 ----
  652.               return;
  653.           }
  654.           else if (BMY < 0)
  655. + /*
  656.               BMY = curenv->top_dots * curenv->lhite;
  657. + */
  658. +             BMY = curenv->top_dots;
  659.       }
  660.       else
  661.           BMY = curenv->top_dots + n * curenv->lhite;
  662. ***************
  663. *** 811,822 ****
  664.   double x;
  665.   {
  666.       if (relative())
  667. !         BMX += x;
  668.       else BMX = x;
  669. !     BMX = max(0.0, BMX);
  670.               /* max == rightmost legal pixel */
  671. !             /* would be pixel 29 if RIGHT_MARGIN == 0 */
  672. !     BMX = min(BMX, (double)((1+RITE_MARGIN)*30)-1);    
  673.   }
  674.   rs_Y(y,decipt)
  675.   double y;
  676. --- 827,837 ----
  677.   double x;
  678.   {
  679.       if (relative())
  680. !         BMX = ((int)(BMX * 12) + (int)(x * 12)) / 12.0;
  681.       else BMX = x;
  682. !     BMX = max(LEFT_LOGICAL, BMX);
  683.               /* max == rightmost legal pixel */
  684. !     BMX = min(BMX, RITE_LOGICAL);    
  685.   }
  686.   rs_Y(y,decipt)
  687.   double y;
  688. ***************
  689. *** 836,853 ****
  690.   int set;
  691.   {
  692.       lastspec.symset = set;
  693.   }
  694.   rs_spacing(n)
  695.   int n;
  696.   {
  697. -     cfn = getcfn();
  698. -     cfn->prop_spaced = n;
  699. -     if (cfn->real_spaced)
  700. -     {
  701. -         cfn->space_len = cfn->real_space_len;
  702. -         curenv->hmi = cfn->real_space_len;
  703. -     }
  704.       lastspec.prop_spaced = n;
  705.   }
  706.   rs_pitch(n)
  707.   double n;
  708. --- 851,863 ----
  709.   int set;
  710.   {
  711.       lastspec.symset = set;
  712. +     try_select = 1;
  713.   }
  714.   rs_spacing(n)
  715.   int n;
  716.   {
  717.       lastspec.prop_spaced = n;
  718. +     try_select = 1;
  719.   }
  720.   rs_pitch(n)
  721.   double n;
  722. ***************
  723. *** 893,899 ****
  724.   rs_ul(n)
  725.   double n;
  726.   {
  727. !     curenv->underline = (int)n;
  728.   }
  729.   rs_thru(n)
  730.   double n;
  731. --- 903,914 ----
  732.   rs_ul(n)
  733.   double n;
  734.   {
  735. !     curenv->underline = 1;        /* can't handle floating yet */
  736. ! }
  737. ! rs_ul_off(n)
  738. ! double n;
  739. ! {
  740. !     curenv->underline = 0;
  741.   }
  742.   rs_thru(n)
  743.   double n;
  744. ***************
  745. *** 1052,1059 ****
  746.           cbm->len = width/8 + 1;
  747.       else cbm->len = width/8;
  748.       cbm->hite = hite;
  749. !     if ((cbm->clen = delta/4) == 0)
  750. !         cbm->clen = 8*cbm->len;    /* yes, I do have some strange fonts */
  751.   
  752.       if (!cf->prop_spaced && c == 'x' && (!cf->chars[' '].clen))
  753.           cf->space_len = cbm->clen;
  754. --- 1067,1075 ----
  755.           cbm->len = width/8 + 1;
  756.       else cbm->len = width/8;
  757.       cbm->hite = hite;
  758. !     cbm->clen = delta/4.0;
  759. !     if (cbm->clen == 0)
  760. !         cbm->clen = 8.0*cbm->len;    /* yes, I do have some strange fonts */
  761.   
  762.       if (!cf->prop_spaced && c == 'x' && (!cf->chars[' '].clen))
  763.           cf->space_len = cbm->clen;
  764. ***************
  765. *** 1228,1235 ****
  766. --- 1244,1255 ----
  767.       if (k < 0 || k >= MAX_PAT)
  768.           k = SOLID;
  769.   
  770. + /*
  771.       bmx = (int)(BMX + .5);
  772.       bmy = (int)(BMY + .5);
  773. + */
  774. +     bmx = BMX;
  775. +     bmy = BMY;
  776.       hlen = (int)(curenv->Hlen + .5);
  777.       vlen = (int)(curenv->Vlen + .5);
  778.   
  779. ***************
  780. *** 1265,1271 ****
  781.   int c;
  782.   {
  783.       struct CHAR_BITMAP *cbm, *ubm;
  784. !     int i, j, k, curx, cury, localy, clen, before;
  785.   
  786.       if (see_thru)
  787.           return;
  788. --- 1285,1292 ----
  789.   int c;
  790.   {
  791.       struct CHAR_BITMAP *cbm, *ubm;
  792. !     int i, j, k, curx, cury, localy, before,startx,endx,curcol,newcol;
  793. !     double clen;
  794.   
  795.       if (see_thru)
  796.           return;
  797. ***************
  798. *** 1275,1282 ****
  799.   
  800.       switch(c)
  801.       {
  802.       case 0x0a:    rs_row(1.0);        return;
  803. !     case 0x0d:    rs_col((double)curenv->left_margin);    return;
  804.       case 0x0e:    setshift(SECONDARY);    return;
  805.       case 0x0f:    setshift(PRIMARY);    return;
  806.       }
  807. --- 1296,1308 ----
  808.   
  809.       switch(c)
  810.       {
  811. +     case 0x09:    curcol = (BMX - curenv->left_margin) / cfn->space_len;
  812. +             newcol = ((curcol + 8) / 8) * 8.0;
  813. +             rs_X((double)curenv->left_margin + 
  814. +                 newcol * cfn->space_len);
  815. +                 return;
  816.       case 0x0a:    rs_row(1.0);        return;
  817. !     case 0x0d:    rs_X((double)curenv->left_margin);    return;
  818.       case 0x0e:    setshift(SECONDARY);    return;
  819.       case 0x0f:    setshift(PRIMARY);    return;
  820.       }
  821. ***************
  822. *** 1293,1300 ****
  823.       if ((!cbm->len) && c != ' ' && c != '\b')
  824.           return;
  825.   
  826. !     bmx = (int)(BMX + .5);
  827. !     bmy = (int)(BMY + .5);
  828.       if (bmx + clen + cbm->loffs >= max_col)
  829.           return;
  830.       cury = bmy - cbm->toffs;
  831. --- 1319,1328 ----
  832.       if ((!cbm->len) && c != ' ' && c != '\b')
  833.           return;
  834.   
  835. !     bmx = (int)BMX;        /* positions should be truncated not rounded */
  836. !     bmy = (int)BMY;
  837. !     startx = bmx;
  838.       if (bmx + clen + cbm->loffs >= max_col)
  839.           return;
  840.       cury = bmy - cbm->toffs;
  841. ***************
  842. *** 1319,1325 ****
  843.   
  844.       if (c > ' ')
  845.       {
  846. !         BMX += (double)clen;
  847.           ymax_used = max(ymax_used,yscale[cury + cbm->hite]);
  848.           xmax_used = max(xmax_used,xscale[curx]);
  849.       }
  850. --- 1347,1353 ----
  851.   
  852.       if (c > ' ')
  853.       {
  854. !         BMX = ((int)(BMX * 12) + (int)(clen * 12)) / 12.0;
  855.           ymax_used = max(ymax_used,yscale[cury + cbm->hite]);
  856.           xmax_used = max(xmax_used,xscale[curx]);
  857.       }
  858. ***************
  859. *** 1326,1350 ****
  860.       else
  861.       {
  862.           if (c != '\b')
  863. !             BMX += (double)clen;
  864. !         else BMX -= (double)clen;
  865.           xmax_used = max(xmax_used,xscale[bmx]);
  866.       }
  867.   
  868.       if (curenv->underline)
  869.       {
  870. !         int after = curx;
  871. !         ubm = &cfn->chars['_'];
  872. !         for (i=0; i<cbm->hite; i++)
  873.           {
  874. !             curx = before;
  875. !             localy = yscale[cury+i];
  876. !             for (j=0; curx<after; )
  877. !                 for (k=0; k<8 && curx<after; k++,curx++)
  878. !                     if (ubm->CH[i][j] & bit[k])
  879. !                         setpix(localy,xscale[curx]);
  880.           }
  881.       }
  882.       dotted = TRUE;
  883. --- 1354,1373 ----
  884.       else
  885.       {
  886.           if (c != '\b')
  887. !             BMX = ((int)(BMX * 12) + (int)(clen * 12)) / 12.0;
  888. !         else BMX = ((int)(BMX * 12) - (int)(clen * 12)) / 12.0;
  889.           xmax_used = max(xmax_used,xscale[bmx]);
  890.       }
  891.   
  892.       if (curenv->underline)
  893.       {
  894. !         endx = BMX;
  895. !         for (i = 5; i < 8 ; i++)        /* fixed underlining */
  896.           {
  897. !             curx = startx;
  898. !             localy = yscale[bmy+i];
  899. !             for (j=0; curx<endx ; curx++)
  900. !                 setpix(localy,xscale[curx]);
  901.           }
  902.       }
  903.       dotted = TRUE;
  904. Index: ./hpp.c
  905. *** /tmp/PATCHold/./hpp.c    Sun Jan  5 23:19:27 1992
  906. --- ./hpp.c    Sun Jan  5 23:19:33 1992
  907. ***************
  908. *** 21,27 ****
  909.   
  910.   #ifndef    lint
  911.   static char SCCSID[] =
  912. !     "@(#)hpp.c 1.2 91/12/04 04:03:57";
  913.   #endif
  914.   
  915.   #include "hptopbm.h"
  916. --- 21,27 ----
  917.   
  918.   #ifndef    lint
  919.   static char SCCSID[] =
  920. !     "@(#)hpp.c 1.4 92/01/05 23:16:48";
  921.   #endif
  922.   
  923.   #include "hptopbm.h"
  924. ***************
  925. *** 157,163 ****
  926.   int    rs_lpi(), rs_plen(), rs_mtop(),
  927.       create_fnthdr(), rs_dpi(), rs_graphxy(),
  928.       rs_pitch(), rs_tlen(), rs_mleft(), rs_mright(),
  929. !     rs_vmi(), rs_row(), rs_col(), rs_ul(), rs_thru(),
  930.       rs_hmi(), rs_lterm(), rs_setpitch(),
  931.       rs_fc_ctl(), rs_stack(), rs_hsize(), rs_hdsize(),
  932.       rs_vsize(), rs_vdsize(), rs_pid(), rs_prnpat();
  933. --- 157,163 ----
  934.   int    rs_lpi(), rs_plen(), rs_mtop(),
  935.       create_fnthdr(), rs_dpi(), rs_graphxy(),
  936.       rs_pitch(), rs_tlen(), rs_mleft(), rs_mright(),
  937. !     rs_vmi(), rs_row(), rs_col(), rs_ul(), rs_ul_off(), rs_thru(),
  938.       rs_hmi(), rs_lterm(), rs_setpitch(),
  939.       rs_fc_ctl(), rs_stack(), rs_hsize(), rs_hdsize(),
  940.       rs_vsize(), rs_vdsize(), rs_pid(), rs_prnpat();
  941. ***************
  942. *** 201,207 ****
  943.       {"&aH",    "Move to Column (Decipoints)",NULL,movedx },
  944.       {"&aV",    "Move to Row (Decipoints)",NULL,movedy },
  945.       {"&dD",    "Underline on",        NULL,    NULL,    rs_ul },
  946. !     {"&d@",    "Underline off",    NULL,    NULL,    rs_ul },
  947.       {"&pX",    "Transparent Print",    NULL,    NULL,    rs_thru },
  948.       {"&lL",    "Perf Skip",         pscont },
  949.       {"&kH",    "HMI",            NULL,    NULL,    rs_hmi },
  950. --- 201,207 ----
  951.       {"&aH",    "Move to Column (Decipoints)",NULL,movedx },
  952.       {"&aV",    "Move to Row (Decipoints)",NULL,movedy },
  953.       {"&dD",    "Underline on",        NULL,    NULL,    rs_ul },
  954. !     {"&d@",    "Underline off",    NULL,    NULL,    rs_ul_off },
  955.       {"&pX",    "Transparent Print",    NULL,    NULL,    rs_thru },
  956.       {"&lL",    "Perf Skip",         pscont },
  957.       {"&kH",    "HMI",            NULL,    NULL,    rs_hmi },
  958. ***************
  959. *** 827,834 ****
  960.           if (c == '\n')
  961.               movetype = RELATIVE;
  962.   
  963. !         if (c == '\f')
  964.               pbmeject(TRUE);
  965.           else prt_hpchr(c);
  966.           movetype = ABSOLUTE;
  967.           }
  968. --- 827,836 ----
  969.           if (c == '\n')
  970.               movetype = RELATIVE;
  971.   
  972. !         if (c == '\f') {
  973.               pbmeject(TRUE);
  974. +             rs_row(0.0);
  975. +         }
  976.           else prt_hpchr(c);
  977.           movetype = ABSOLUTE;
  978.           }
  979. ***************
  980. *** 841,846 ****
  981. --- 843,850 ----
  982.   movex(num)
  983.   double num; {
  984.       curX = num;
  985. +     if (movetype == ABSOLUTE)
  986. +     curX += LEFT_LOGICAL;
  987.       if (rast)
  988.       rs_X(curX);
  989.       if (genps)
  990. ***************
  991. *** 859,864 ****
  992. --- 863,870 ----
  993.   movedx(num)
  994.   double num; {
  995.       curX = num * 300.0 / 720.0;
  996. +     if (movetype == ABSOLUTE)
  997. +     curX += LEFT_LOGICAL;
  998.       if (rast)
  999.       rs_X(curX);
  1000.       if (genps)
  1001. ***************
  1002. *** 1005,1011 ****
  1003.   int inc; {
  1004.       int (*old_func)();
  1005.   
  1006. !     sprintf(pbmtname,"%s.%d",pbmname,pbmpage);
  1007.       pbmpage += inc;
  1008.       if (have_auto_macro > -1) {
  1009.       old_func = getchar_func;
  1010. --- 1011,1020 ----
  1011.   int inc; {
  1012.       int (*old_func)();
  1013.   
  1014. !     if (pbmname[0] == '|')
  1015. !     strcpy(pbmtname, pbmname);
  1016. !     else
  1017. !     sprintf(pbmtname,"%s.%d",pbmname,pbmpage);
  1018.       pbmpage += inc;
  1019.       if (have_auto_macro > -1) {
  1020.       old_func = getchar_func;
  1021. Index: ./hptopbm.h
  1022. *** /tmp/PATCHold/./hptopbm.h    Sun Jan  5 23:20:12 1992
  1023. --- ./hptopbm.h    Sun Jan  5 23:20:19 1992
  1024. ***************
  1025. *** 16,25 ****
  1026.       Canada K0A 1T0
  1027.       (613) 832-0541
  1028.   
  1029. !     Function: Header file for hp2pbm.  1.1 91/12/03 00:34:41
  1030.    */
  1031.   
  1032. ! #define    VERSION    "hp2pbm V1.00"
  1033.   
  1034.   #include <stdio.h>
  1035.   #include <ctype.h>
  1036. --- 16,25 ----
  1037.       Canada K0A 1T0
  1038.       (613) 832-0541
  1039.   
  1040. !     Function: Header file for hp2pbm.  1.3 92/01/05 23:17:02
  1041.    */
  1042.   
  1043. ! #define    VERSION    "hp2pbm V1.01"
  1044.   
  1045.   #include <stdio.h>
  1046.   #include <ctype.h>
  1047. ***************
  1048. *** 51,56 ****
  1049. --- 51,57 ----
  1050.   
  1051.   #define    TOP_MARGIN    3    /* half inch, 300/6lpi = 3 lines */
  1052.   #define    LEFT_MARGIN    0    /* char column pos, not dots */
  1053. + #define LEFT_LOGICAL    50
  1054.   
  1055.   /* CONFIG: if !A4, define your default paper size (A4/LETTER are best for fax) */
  1056.   #if    (!A4) && (!LETTER) && (!LEGAL) && (!B5)
  1057. ***************
  1058. *** 60,80 ****
  1059. --- 61,85 ----
  1060.   #if    LETTER
  1061.   #define    PAGE_LEN    66
  1062.   #define    RITE_MARGIN    80
  1063. + #define RITE_LOGICAL    LEFT_LOGICAL+2400
  1064.   #endif
  1065.   
  1066.   #if    A4
  1067.   #define    PAGE_LEN    70
  1068.   #define    RITE_MARGIN    77
  1069. + #define RITE_LOGICAL    LEFT_LOGICAL+2338
  1070.   #endif
  1071.   
  1072.   #if    LEGAL
  1073.   #define    PAGE_LEN    84
  1074.   #define    RITE_MARGIN    80
  1075. + #define RITE_LOGICAL    LEFT_LOGICAL+2400
  1076.   #endif
  1077.   
  1078.   #if    B5
  1079.   #define    PAGE_LEN    60
  1080.   #define    RITE_MARGIN    66
  1081. + #define RITE_LOGICAL    LEFT_LOGICAL+2400    /* dont know about B5's */
  1082.   #endif
  1083.   
  1084.   #define    PRIMARY        1
  1085.  
  1086. -- 
  1087. Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
  1088. Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
  1089. Moderator of the ferret list: ferret-request@ferret.ocunix.on.ca
  1090. **** NEVER let something mechanical know you're in a hurry. ****
  1091.  
  1092. exit 0 # Just in case...
  1093.